<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 基本表单</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="../favicon.ico">
    <link href="/Public/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link rel="stylesheet" href="/Public/css/ace.min.css" />
    <link href="/Public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link href="/Public/css/style.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/Public/admin/css/gxxj/normalize.css">

    <style type="text/css">
        .span_right{
            float: right;
        }
        .down-menu{
            height: 35px;
            line-height: 35px;
        }
        .search_div{
            background: none;
            border: none;
            width: 450px !important;
        }
        .m-search{
            display: flex;
            margin-left: 30px;
        }
        .outbound{
            display: inline-block;
            /*float: left;*/
            text-align: center;
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>用户信息-
                        <small>用户列表</small>
                    </h5>
                    <div class="ibox-tools">
                        <form method="get" action="<{$SRVER_NAME}>/admin.php/Outbound/FK_UserList"  style="display: flex;   margin-right: 30px;" class="pull-right mail-search">
                            <!--<div class="m-search" style="display: flex">-->
                                <!--<input type="hidden" name="rid" value="<{$rid}>">-->
                                <!--<input type="hidden" name="type" value="<{$url_type}>">-->
                                <!--<input  class="form-control input-sm" type="text" name="user" placeholder="搜索用户" value="<{$user_content}>"/>-->
                                <!--<div class="input-group-btn">-->
                                    <!--<button type="submit" class="btn btn-sm btn-primary">-->
                                        <!--搜索-->
                                    <!--</button>-->
                                <!--</div>-->
                            <!--</div>-->
                        </form>

                    </div>
                </div>
                <div style="display: block;margin-left: 65px">
                    <select style="width: 100px" id="kf_select">
                        <volist name="kefu" id="vo">
                            <option value="<{$vo.kf_id}>"><{$vo.name}></option>
                        </volist>

                    </select>
                    <input type="submit"  onclick="send()" class="btn btn-sm btn-primary" value=" 派 发">

                    </input>
                </div>
                <div class="ibox-content">

                    <table class="table table-striped table-bordered table-hover" id="sample-table">
                        <thead>
                        <tr>
                            <th><input id="all_check" type="checkbox" level="1" style="width: 20px;height: 20px"></th>
                            <th>序号</th>
                            <th>用户名</th>
                            <th>手机号</th>
                            <th>性别</th>
                            <th>注册时间</th>
                            <th>认证时间</th>
                            <th>项目</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <volist name="data" id="vo" >
                            <tr id="tr_<{$vo.vid}>">
                                <td><input  type="checkbox"  name="send_check" id="<{$vo.id}>" value="<{$vo.vid}>" style="width: 20px;height: 20px" >  </td>
                                <td><{$i}></td>
                                <td><{$vo.truename}></td>
                                <td><{$vo.mobile}></td>
                                <td><{$vo.sex}></td>
                                <td style="width: 140px"><{$vo.ctime}></td>
                                <td style="width: 140px"><{$vo.cert_time}></td>
                                <td style="width: 140px"><{$vo.type}></td>
                                <td style="width: 245px">   <a href="<{$SRVER_NAME}>/admin.php/UserInfo/user_list_details?vid=<{$vo.vid}>" class="btn btn-xs btn-primary"> 用户详情 </a></td>

                            </tr>
                        </volist>
                        </tbody>
                    </table>
                    <div class="dataTables_paginate paging_simple_numbers" >
                        <ul class="pagination">
                            <if condition="$tol gt 10">
                                <{$fpage}>
                            </if>

                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Public/js/content.js?v=1.0.0"></script>
<script src="/Public/admin/js/layer/layer.js"></script>
<script src="/Public/admin/js/layui/layui.js"></script>


<script type="text/javascript">

     var isCheckAll=false;
    $("#all_check").click(function(){
        if (isCheckAll) {
            $("input[type='checkbox']").each(function() {
                this.checked = false;
            });
            isCheckAll = false;
        } else {
            $("input[type='checkbox']").each(function() {
                this.checked = true;
            });
            isCheckAll = true;
        }
//
//        if(document.getElementById("all_check").checked){
//            $("input[name='send_check']").removeAttr("checked");
//
//        }else{
//            $("input[name='send_check']").attr("checked","true");
//
//        }

    })

function send() {
    var obj=document.getElementsByName("send_check");
    var  txt="";
    var i;
    for ( i=0;i<obj.length;i++){
        if (obj[i].checked){
           txt=txt+obj[i].value+",";
        }
    }

    var txt1=txt.substring(0,txt.length-1);
    var index = layer.load(1, {
        shade: [0.1, '#fff'] //0.1透明度的白色背景
    });

    var url = "<{$SRVER_NAME}>/admin.php/OutboundManerger/send_add";
    if (txt.length<=0) {
        layer.close(index);
        layer.alert("请选择！\r\n", {
            title: '提示框',
            icon: 0,
        });
        return false;
    }

    //获取客服
    var kf_id=$("#kf_select").val();

    layer.alert("确认分配？", {
        title: '提示框',
        icon: 3,
    },function (index) {
        console.log('txt',txt1+'---'+kf_id);
        $.post("<{$SRVER_NAME}>/admin.php/CertUser/send_kefu",{vids:txt1,kf_id:kf_id,type:1},function (data) {
            console.log('ddddaa',data);
            if(data.code=='1001'){
                layer.alert("分配成功！\r\n", {
                title: '提示框',
                icon: 1,
            });
                window.location.reload();
            }else{
                layer.alert("分配失败！\r\n", {
                    title: '提示框',
                    icon: 2,
                });
            }
            layer.close(index);

        });
    });
    layer.close(index);
}
//// 选择分配人员的弹框
//     function show_send(txt){
//         var url_type="<{$url_type}>";
//         layer.open({
//             title:'选择派发',
//             type: 2,
//             area: ['80%', '80%'],
//             maxmin: true,
//             offset:'100px',
//             content: '<{$SRVER_NAME}>/admin.php/OutboundManerger/send_view.html?txt='+txt+'&url_type='+url_type,
//             success: function(layero){
//                 layero.find('.layui-layer-min').remove();
//             }
//         });
//     }

</script>

</body>
</html>
